package com.mmall.task;

import com.mmall.service.IOrderService;
import com.mmall.util.PropertiesUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author:lzq
 * @date: 2018/4/12 10:53
 */
@Slf4j
@Component
public class OrderTask {

    @Autowired
    private IOrderService orderService;
    @Scheduled(cron = "0 */1 * * * ?")  //每分钟执行一次
    public void closeOrderTskV1(){
        log.info("定时关单任务启动");
        orderService.closeOrder(Integer.parseInt(PropertiesUtil.getProperty("close.order.task.time.hour","2")));
        log.info("定时关单任务成功");
    }

}
